package com.song.pj.goods.dao;

import com.song.pj.goods.pojo.Goods;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.sql.SQLException;
import java.util.List;
@Repository//描述数据层实现类，用于交给spring管理
public class GoodsDaoImpl implements GoodsDao{
    @Autowired
     private SqlSession sqlSession;
//     Connection conn = sqlSession.getConnection();
//     String sql = "select * from db_goods";
     @Override
    public List<Goods> findGoods() throws SQLException {
//         Statement stat = conn.createStatement();
//         ResultSet rs = stat.executeQuery(sql);
//        return sqlSession.getMapper(GoodsDao.class).findGoods();
         return  sqlSession.selectList("com.song.pj.goods.dao.GoodsDao.findGoods");
     }

}
